
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <script src="../js/Timetables.min.js"></script>
    <script src="../js/jquery.js"></script>
    <title>大学课表</title>
    <style>
        #coursesTable {
            padding: 15px 40px;
        }

        .Courses-head {
            background-color: #edffff;
        }

        .Courses-head > div {
            text-align: center;
            font-size: 14px;
            line-height: 28px;
        }

        .left-hand-TextDom, .Courses-head {
            background-color: #f2f6f7;
        }

        .Courses-leftHand {
            background-color: #f2f6f7;
            font-size: 12px;
        }

        .Courses-leftHand .left-hand-index {
            color: #9c9c9c;
            margin-bottom: 4px !important;
        }

        .Courses-leftHand .left-hand-name {
            color: #666;
        }

        .Courses-leftHand p {
            text-align: center;
            font-weight: 900;
        }

        .Courses-head > div {
            border-left: none !important;
        }

        .Courses-leftHand > div {
            padding-top: 5px;
            border-bottom: 1px dashed rgb(219, 219, 219);
        }

        .Courses-leftHand > div:last-child {
            border-bottom: none !important;
        }

        .left-hand-TextDom, .Courses-head {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        }

        .Courses-content > ul {
            border-bottom: 1px dashed rgb(219, 219, 219);
            box-sizing: border-box;
        }

        .Courses-content > ul:last-child {
            border-bottom: none !important;
        }

        .highlight-week {
            color: #02a9f5 !important;
        }

        .Courses-content li {
            text-align: center;
            color: #666666;
            font-size: 14px;
            line-height: 50px;
        }

        .Courses-content li span {
            padding: 6px 2px;
            box-sizing: border-box;
            line-height: 18px;
            border-radius: 4px;
            white-space: normal;
            word-break: break-all;
            cursor: pointer;
        }

        .grid-active {
            z-index: 9999;
        }

        .grid-active span {
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
        }
    </style>
</head>
<body onload="kb();">
<div id="coursesTable"></div>


<script>
  
  var courseList = [
        ['大学英语(Ⅳ)@10203', '大学英语(Ⅳ)@10203', '', '', 'a', '', '毛概@14208', '毛概@14208'],
        ['', '', '信号与系统@11302', '信号与系统@11302', '模拟电子技术基础@16204', '模拟电子技术基础@16204', '', ''],
        ['大学体育(Ⅳ)', '大学体育(Ⅳ)', '形势与政策(Ⅳ)@15208', '形势与政策(Ⅳ)@15208', '', '', '电路、信号与系统实验', '电路、信号与系统实验'],
        ['', '', '', '', '电装实习@11301', '电装实习@11301', '', ''],
        ['', '', '数据结构与算法分析', '数据结构与算法分析', '', '', '', ''],
        ['', '', '', '', '1234', '1234', '', ''],
        ['', '', '', '', '1234', '1234', '', ''],
  ];
  function kb(){
  $.ajax({
    type: "post",				
			url: "/getTimetables",			//请求地址******************************************************************************要填
			data:{
			},//账号，密码
			
			async:true,
			dataType:"json",//返回类型
			xhrFields:{
				withCredentials:true,
			},
			crossDomain: true,
      success:function(data){
        var courseList = [
        [data[0].one, data[0].one, data[0].two, data[0].two, data[0].three, data[0].three, data[0].four, data[0].four],
        [data[1].one, data[1].one, data[1].two, data[1].two, data[1].three, data[1].three, data[1].four, data[1].four],
        [data[2].one, data[2].one, data[2].two, data[2].two, data[2].three, data[2].three, data[2].four, data[2].four],
        [data[3].one, data[3].one, data[3].two, data[3].two, data[3].three, data[3].three, data[3].four, data[3].four],
        [data[4].one, data[4].one, data[4].two, data[4].two, data[4].three, data[4].three, data[4].four, data[4].four],
        [data[5].one, data[5].one, data[5].two, data[5].two, data[5].three, data[5].three, data[5].four, data[5].four],
        [data[6].one, data[6].one, data[6].two, data[6].two, data[6].three, data[6].three, data[6].four, data[6].four],


      ];


          var week = window.innerWidth > 360 ? ['周一', '周二', '周三', '周四', '周五', '周六', '周天'] :
              ['一', '二', '三', '四', '五', '六', '天'];
          var day = new Date().getDay();
          var courseType = [
              [{index: '1', name: '8:30'}, 1],
              [{index: '2', name: '9:30'}, 1],
              [{index: '3', name: '10:30'}, 1],
              [{index: '4', name: '11:30'}, 1],
              [{index: '5', name: '12:30'}, 1],
              [{index: '6', name: '14:30'}, 1],
              [{index: '7', name: '15:30'}, 1],
              [{index: '8', name: '16:30'}, 1],

          ];
          // 实例化(初始化课表)
          var Timetable = new Timetables({
              el: '#coursesTable',
              timetables: courseList,
              week: week,
              timetableType: courseType,
              highlightWeek: day,
              gridOnClick: function (e) {
                  alert(e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节');
                  console.log(e);
              },
              styles: {
                  Gheight: 50
              }
          });
      }

  });
  }
      
  


</script>
</body>
</html>
